package com.wei.frame.di.module;

import android.app.Application;
import android.content.Context;

import androidx.annotation.Nullable;

import com.google.gson.Gson;
import com.wei.frame.db.DBManager;
import com.wei.frame.net.RetrofitManager;
import com.wei.frame.utils.AppManager;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * 作者:赵若位
 * 时间:2020/8/20 3:10
 * 功能:
 */
@Module
public class AppModule {
    @Singleton
    @Provides
    public static Context provideContext(@Nullable Application application) {
        return application.getApplicationContext();
    }

    @Singleton
    @Provides
    public static Gson providerGson() {
        return new Gson();
    }


    @Singleton
    @Provides
    public static AppManager providerAppManager() {
        return AppManager.getInstance();
    }

    @Singleton
    @Provides
    public static RetrofitManager providerRetrofitManager() {
        return RetrofitManager.getInstance();
    }

    @Singleton
    @Provides
    public static DBManager providerDBManager(Context context) {
        return DBManager.getInstance(context);
    }
}
